package com.open.center.jwt.provider;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

/**
 * Jwt Claim
 *
 * @author Riche's
 * @since 2025/5/23
 */
@Data
public class JwtClaim {

    /**
     * 颁发者身份标识
     * <a href="https://www.rbac.com">RBAC</a>
     */
    private String issuer = "https://www.rbac.com";

    /**
     * rbac
     */
    private String subject = "Rbac";

    /**
     * 希望谁签收
     */
    private String audience = "All";

    /**
     * 过期时间，应大于签发时间
     */
    private Date expirationTime;

    /**
     * 生效时间
     */
    private Date notBefore;

    /**
     * 签发时间
     */
    private Date issuedAt;

    /**
     * JWT 唯一Id，避免重放攻击
     */
    private String jwtId;

    
    @JsonIgnore
    private final Map<String, Object> any = new LinkedHashMap<>();

    @JsonAnyGetter
    public Map<String, Object> getter() {
        return any;
    }

    @JsonAnySetter
    public void setter(String key, Object value) {
        any.put(key, value);
    }

}
